package demo7

import (
	"fmt"
)

// Phone interface
type Phone interface {
	call()
}

// NokiaPhone struct 结构体
type NokiaPhone struct {
	color string
	price int
}

// IPhone iphone
type IPhone struct {
	color string
	price int
}

// 实现接口
func (nokiaPhone NokiaPhone) call() {
	fmt.Println("This is NokiaPhone")
}

func (iphone IPhone) call() {
	fmt.Println("This is IPhone")
}

// TestDemo72 接口
func TestDemo72() {
	// 接口类型
	var phone1 Phone
	var phone2 Phone

	// 实例1
	phone1 = new(NokiaPhone)
	phone1.call()

	// 实例2
	phone2 = new(IPhone)
	phone2.call()
}
